package org.example.myleet.p551;

public class Solution {
    public boolean checkRecord(String s) {
        int a = 0, l = 0;
        for (int i = 0; i < s.length(); ++i) {
            char c = s.charAt(i);
            if (c == 'A') {
                ++a;
                if (a > 1) {
                    return false;
                }
                l = 0;
            } else if (c == 'L') {
                ++l;
                if (l > 2) {
                    return false;
                }
            } else {
                l = 0;
            }
        }
        return true;
    }
}
